package projects;

public class Node {
	
	private int positionI;
	private int positionJ;	
	private Node[] outNodes;	
	private double[] outWeights;
	private double netValue;
	private double outValue;
	private double targetValue;
	private double delta;
	
	public Node(int i, int j) {
		positionI = i;
		positionJ = j;
		setNetValue(0);
		setOutValue(0);
		setDelta(0);
	}
	
	public Node[] getOutNodes() {
		return outNodes;
	}	
	
	public double[] getOutWeights() {
		return outWeights;
	}
	
	public double getNetValue() {
		return netValue;
	}
	
	public double getOutValue() {
		return outValue;
	}
	
	public double getTargetValue() {
		return targetValue;
	}
	
	public double getDelta() {
		return delta;
	}
	
	public void setOutNodes(Node[] outNodes) {
		this.outNodes = outNodes;
	}
	
	public void setOutWeights(double[] outWeights) {
		this.outWeights = outWeights;
	}	
	
	public void setNetValue(double netValue) {
		this.netValue = netValue;
	}
	
	public void setOutValue(double outValue) {
		this.outValue = outValue;
	}
	
	public void setTargetValue(double targetValue) {
		this.targetValue = targetValue;
	}
	
	public void setDelta(double delta) {
		this.delta = delta;
	}
	
	public void addToNetValue(double amount) {
		netValue += amount;
	}
	
	public String toString() {
		String nodeString = "\tNode(" + positionI + "," + positionJ + "):\n";
		
		nodeString += "\t\toutValue: " + outValue + "\n";
		nodeString += "\t\tnetValue: " + netValue + "\n";
		nodeString += "\t\tdelta: " + delta + "\n";
		
		if (outNodes != null) {
			nodeString += "\t\toutNodes: ";
			for (Node node : outNodes)
				nodeString += "(" + node.positionI + "," + node.positionJ + ")";
			nodeString += "\n";
			
			nodeString += "\t\toutWeights: ";
			for (double weight : outWeights)
				nodeString += weight + " ";
			nodeString += "\n";
		}
		
		return nodeString;
	}
}
